Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secret-sharing: Zeroize sensitive data #5928

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

peternose
Copy link
Contributor

No description provided.

@peternose peternose added the c:key management Category: key management label Nov 5, 2024
Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for oasisprotocol-oasis-core canceled.

Name Link
🔨 Latest commit a3e8637
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-oasis-core/deploys/672ae7e15f3754000827c93d

@peternose peternose linked an issue Nov 5, 2024 that may be closed by this pull request
@peternose peternose force-pushed the peternose/trivial/churp-zeroize-secrets branch from d0fabf6 to cf516e0 Compare November 6, 2024 03:23
PrimeField implements the Copy trait, which means values are copied when
passed as parameters. To prevent sensitive data from being replicated,
the switch point struct should accumulate points rather than coordinates.
The AddAssign, SubAssign, and MulAssign functions can now be used
only when the prime field supports zeroization. This ensures that
any leftover data from heap reallocation, when the right-hand-side
polynomial has more coefficients than the left-hand-side, is zeroized.

An alternative solution is to remove these functions, but this
could lead to performance drawbacks.
@peternose peternose force-pushed the peternose/trivial/churp-zeroize-secrets branch from cf516e0 to a3e8637 Compare November 6, 2024 03:52
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.62%. Comparing base (7dd0c3e) to head (a3e8637).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5928   +/-   ##
=======================================
  Coverage   64.62%   64.62%           
=======================================
  Files         627      627           
  Lines       64292    64292           
=======================================
+ Hits        41546    41550    +4     
+ Misses      17823    17820    -3     
+ Partials     4923     4922    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peternose peternose marked this pull request as ready for review November 6, 2024 04:28

// Encrypt data using seal_into so that we can zeroize the plaintext.
let mut ciphertext = Vec::with_capacity(plaintext.len() + TAG_SIZE + NONCE_SIZE);
unsafe { ciphertext.set_len(plaintext.len() + TAG_SIZE) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need unsafe here? Couldn't you just use ciphertext.resize instead?


// Encrypt data using seal_into so that we can zeroize the plaintext.
let mut ciphertext = Vec::with_capacity(plaintext.len() + TAG_SIZE + NONCE_SIZE);
unsafe { ciphertext.set_len(plaintext.len() + TAG_SIZE) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:key management Category: key management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zeroize sensitive CHURP data
2 participants